import {defineStore} from 'pinia'
import { ref } from 'vue'

export const useCount=defineStore("count",{
    state:()=>({
        num:0
    }),
    actions:{
        add(){
            this.num++
        },
        minus(){
            this.num--
        }
    }
})

export const useCountRef=defineStore("countRef",()=>{
    let num=ref(0)
    const add=()=>{
        num.value=num.value+1
    }
    const min=()=>{
        num.value=num.value-1
    }
    return {
        num,
        add,
        min
    }
})